<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<div id="page-content">
    <div class="row">

        <div class="col-lg-12">
            <div class="panel">
                <div class="panel-heading">
                    <h3 class="panel-title">企业信息</h3>
                </div>
                <form class="panel-body form-horizontal">
                    <div class="form-inline">
                        <div class="row">
                            <div class="col-lg-offset-3 col-lg-3 table-toolbar-left">
                                <btn id="btn_edit_company" class="btn btn-outline btn-default btn-sm">
                                    <i class="fa fa-pencil-square-o"> </i> 编辑
                                </btn>
                            </div>
                            <div class="col-lg-6 table-toolbar-left">
                                <btn id="btn_edit_company" class="btn btn-outline btn-primary btn-sm">
                                    <i class="fa fa-pencil-square-o"> </i> 保存
                                </btn>
                            </div>
                        </div>
                    </div>
                    <div id="company_info">
                    </div>
                </form>
            </div>
        </div>

    </div>
</div>

<script id="templates_company_info" type="text/x-jsrender">

    <div class="form-group">
        <label class="col-lg-3 control-label">企业全称</label>
        <div class="col-lg-7">
            <input type="text" name="name" id="name" value="{{:name}}" class="form-control" placeholder="请输入企业全称" disabled>
        </div>
    </div>
    <div class="form-group">
        <label class="col-lg-3 control-label">企业简称</label>
        <div class="col-lg-7">
            <input type="text" name="subname" id="subname" value="{{:subname}}" class="form-control" placeholder="请输入企业简称" disabled>
        </div>
    </div>
    <div class="form-group">
        <label class="col-lg-3 control-label">所在地区</label>
        <div class="col-lg-2">
            <select name="province" id="province" class="form-control" disabled></select>
        </div>
        <div class="col-lg-2">
            <select name="city" id="city" class="form-control" disabled></select>
        </div>
        <div class="col-lg-2">
            <select name="county" id="county" class="form-control" disabled></select>
        </div>
    </div>

</script>

<script src="../resource/core/js/core/app-address.js"></script>

<script>

    $(function(){

        // 加载数据
        fn_company_info_load();

    });

    function fn_company_info_load() {
        var templates =  $.templates('#templates_company_info');
        var url = '<%=path%>/main/company/read';
        $.getJSON(url, function(data) {
            if (data.state == 1) {
                var entity = data.data;

                // 初始化模板
                var html  = templates.render(entity);
                $('#company_info').html(html);

                // 省市区
                addressInit('province', 'city', 'county', entity.province, entity.city, entity.county);

            }
        });
    }



</script>